<?php
/**
 * 学生界面- -物资借用
*/

use yii\grid\GridView;

use app\models\MaterialborrowSearchForPerson;
use yii\helpers\Html;

/* @var $this yii\web\View */
/* @var $searchModel app\models\LiterarySearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '物资借用';
$this->params['breadcrumbs'][] = $this->title;
?>

<?php    
    $searchModel = new MaterialborrowSearchForPerson($id);
    $dataProvider = $searchModel->search(\Yii::$app->request->queryParams); 
 ?>

<div class="literary-model-index">
	
	<p>
		<?= Html::a('租用物资', ['creatematerial'], ['class' => 'btn btn-success']) ?>
	</p>
	
    <?= GridView::widget([
        'dataProvider' => $dataProvider,
    		'filterModel'=>$searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

            'stu_id',
            'stu_name',
            'activitytitle',
            'material',
            'telephone',
            'time',
            'approved',
            'remark',
        	[
        		'class' => 'yii\grid\ActionColumn',
        		'header' => '操作',
        		'template' => '{update}',
        		'buttons' =>
        		[
        				'update' => function ($url,$model, $key) {
        				return $model->approved=='审批中'?Html::a('<button>修改</button> ', '/bnews/web/apply/materialupdate?id='.$model->id,['title' => '修改'] ):'';
        				},
        				
        				],
        				'headerOptions' => ['width' => '80'],
        		
        	],
        ],
    ]); ?>
</div>
